package cn.herlioner.dao.impl;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

import cn.herlioner.dao.StudentSocialMessageDAO;
import cn.herlioner.pojo.Studentsocialmessage;


public class StudentSocialMessageDAOImpl implements StudentSocialMessageDAO
		{

	@Override
	public Studentsocialmessage get(Long stunum) {
		Studentsocialmessage result = null;
		 
        SessionFactory sf = new Configuration().configure()
                .buildSessionFactory();
        Session s = sf.openSession();
 
        result = (Studentsocialmessage) s.get(Studentsocialmessage.class, stunum);
 
        s.close();
        sf.close();
        return result;

	}

	public void saveSocial(Studentsocialmessage studentsocial) {
		SessionFactory sf = new Configuration().configure()
				.buildSessionFactory();
		Session se = sf.openSession();
		se.beginTransaction();
		
		se.save(studentsocial);
		
		se.getTransaction().commit();
		se.close();
		sf.close();
		
	}

}
